<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<head>
    <title>Title</title>
    <%@include file="../../common.jsp"%>
</head>
<style>
    body{
        font-size: 12px;
    }
    #taskTable tr{
        font-size: 12px;
    }
</style>
<body>
<h2>缺陷查询</h2>
<hr>
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">线路编号:</label>
                <div class="layui-input-inline" style="width: 200px;">
                    <input id="lineCode" type="text" name="price_min" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">缺陷类型:</label>
                <div class="layui-input-inline">
                    <select name="bugTypeId" id="bugTypeId" width="300px" lay-filter="bugType">
                        <option value="-1">请选择</option>
                    </select>
                </div>
                <label class="layui-form-label">缺陷级别:</label>
                <div class="layui-input-inline">
                    <select name="bugLevelId" id="bugLevelId" width="300px" lay-filter="bugLevel">
                        <option value="-1">请选择</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">发现时间:</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="startTime" placeholder="yyyy-MM-dd">
                </div>
                <div class="layui-form-label" style="width:5px">-</div>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input testl" id="endTime" placeholder="yyyy-MM-dd">
                </div>

                <div class="layui-input-inline" style="width: 100px;">
                    <button type="button" class="layui-btn layui-btn-normal" onclick="searchData();"><i class="layui-icon layui-icon-search"></i> 查询</button>
                </div>
            </div>

        </div>
    </form>
    <table class="layui-table" id="taskTable" lay-filter="taskTable"></table>

    <script>

        //赋值下拉框
        //缺陷类型
        $.get("/systemConfig/getBugType",function (data) {
            $.each(data,function () {
                var option = $('<option></option>').appendTo("#bugTypeId");
                option.text(this.configValueName).val(this.configValueId);
            })
        })
        //缺陷级别
        $.get("/systemConfig/getBugLevel",function (data) {
            $.each(data,function () {
                var option = $('<option></option>').appendTo("#bugLevelId");
                option.text(this.configValueName).val(this.configValueId);
            })
        })
        var taskId;//巡检任务编号,用户查看任务详情
        //全局定义一次, 加载formSelects
        layui.config({
            base: '${path}/layui/lay/modules/' //此处路径请自行处理, 可以使用绝对路径
        }).extend({
            formSelects: 'formSelects-v4.min'
        });


       function searchData(){
            layui.table.reload("taskTable",{
                page:{
                    curr : 1
                },
                where:{
                    "lineCode" : $("#lineCode").val(),
                    "bugLevelId" : $("#bugLevelId").val(),
                    "startTime" : $("#startTime").val(),
                    "endTime" : $("#endTime").val(),
                    "bugTypeId" : $("#bugTypeId").val()
                }
            });
        }


        layui.use(["table","form","formSelects","laydate"],function () {
            var table = layui.table;
            table.render({
                id: 'taskTable',
                elem: '#taskTable',
                url: '/bugSel/getlistBug',
                page: true,
                even: false,
                cols: [[
                    {field: 'lineCode', title: '线路编号'},
                    {field: 'poleCode', title: '杆塔编号'},
                    {field: 'bugLevelName', title: '缺陷级别'},
                    {field: 'bugTypeName', title: '缺陷类型'},
                    {field: 'discovererName', title: '发现人'},
                    {field: 'discoverTime', title: '发现时间'},
                    {field: 'intactRate', title: '完好率'},
                    {field: 'bugDesc', title: '缺陷描述'},
                ]]
            })
        })

        layui.use('laydate',function () {
            var laydate = layui.laydate;

            laydate.render({
                elem:'#startTime'
            });
            laydate.render({
                elem:'#endTime'
            });
            laydate.render({
                elem: '#issuedTime'
                ,value: new Date()
                ,isInitValue: true
            });
        });

    </script>
    <script type="text/html" id="lockedTem">
        <input type="checkbox" disabled lay-skin="switch" title="是否取消" lay-text="是|否" {{d.isCancel == 1 ? 'checked' : ''}}>
    </script>

</body>
</html>
